﻿
(function ($) {
    app.modals.CreateOrEditCartypeModal = function () {

        var _modalManager;

        var _cartypeService = abp.services.app.cartype;

		//$(".maxlength-handler").maxlength({
        //    limitReachedClass: "label label-danger",
        //    alwaysShow: true,
        //    threshold: 5,
        //    placement: 'bottom'
        //});

        var _$cartypeInformationForm = null;


        this.init = function (modalManager) {
            _modalManager = modalManager;
			            _$cartypeInformationForm = _modalManager.getModal().find("form[name=cartypeInformationsForm]");

						
			 
			   	 


						
			 
			   	 


						
			 
			   	 


			
			
      


        }
        
        this.save = function () {
            if (!_$cartypeInformationForm.valid()) {
                return;
            }
            //校验通过

            var cartype = _$cartypeInformationForm.serializeFormToObject();
          //  console.log(cartype);

            _modalManager.setBusy(true);

            _cartypeService.createOrUpdateCartypeAsync({
                cartypeEditDto: cartype
            }).done(function () {
                //提示信息
                abp.notify.info(app.localize('SavedSuccessfully'));
                //关闭窗体
                _modalManager.close();
                //信息保存成功后调用事件，刷新列表
                abp.event.trigger('app.createOrEditCartypeModalSaved');
            }).always(function () {
                _modalManager.setBusy(false);
            });
        }
    }
})(jQuery);

   